package com.tsmti.basicdata.service.impl;

import com.tsmti.core.common.service.impl.BaseServiceImpl;
import com.tsmti.basicdata.entity.DoctorInformation;
import com.tsmti.basicdata.service.DoctorInformationService;
import com.tsmti.core.util.ConvertUtil;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Package：com.tsmti.lab.service.impl
 * @Class：DoctorInfomationServiceImpl
 * @Description： TODO
 * @Author：dcd
 * @Date：Created in 2018/7/3 下午2:13
 * @Company:
 * @Version：
 * @Modified By:
 */
@Service("doctorInformationService")
public class DoctorInformationServiceImpl extends BaseServiceImpl<DoctorInformation> implements DoctorInformationService {
    @Override
    public List<DoctorInformation> getHighLevelByCode(String code, String orgId) {
        List<DoctorInformation> list = new ArrayList<>();
        String hql = " from DoctorInformation where (name like '%" + code + "%' or userNo like '%" + code + "%' or UPPER(spell) like  '%" + code + "%' )  and jobLevel > 1";
        if(!ConvertUtil.isEmpty(orgId)){
            hql +=" and orgId='"+orgId+"'";
        }
        list =findByHql(hql);
        return list;
    }

    @Override
    public List<DoctorInformation> getHighLevel(String orgId) {
        List<DoctorInformation> list = new ArrayList<>();
        String hql=" from DoctorInformation where description like '%医务%'";
        if(!ConvertUtil.isEmpty(orgId)){
            hql +=" and orgId='"+orgId+"'";
        }
        list =findByHql(hql);
        return list;
    }

    @Override
    public List<DoctorInformation> getMedicalDoctor(String orgId) {
        List<DoctorInformation> list = new ArrayList<>();
        String hql = " from DoctorInformation where rownum <= 20 and jobLevel > 1";
        if(!ConvertUtil.isEmpty(orgId)){
            hql +=" and orgId='"+orgId+"'";
        }
        list =findByHql(hql);
        return list;
    }
}
